<!DOCTYPE html>
<html>
<head>
    <title>管理员列表 - 后台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" type="text/css" href="../../../static/layui/css/layui.css" media="all">
    <script type="text/javascript" src="../../../static/layui/layui.js"></script>
    <style type="text/css">
        .header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
        .header div{border-bottom:solid 2px #009688;margin-top: 8px;}
        .header button{float:right;margin-top:-5px;}
    </style>
</head>
<body style="padding:10px; box-sizing: border-box;">
<div class="header">
    <a href="/tp5/public/index.php/bews/Bew/menuInfo"><span style="background-color: #999999">导航列表</span></a>
    <span>菜单列表</span>
    <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="add()">
        <i class="layui-icon layui-icon-add-1"></i>添加
    </button>
    <div></div>
</div>
<table class="layui-table">
    <thead>
    <tr>
        <th>ID</th>
        <th>菜单名称</th>
        <th>排序</th>
        <th>跳转url</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {foreach($lists as $lists_v)}
    <tr>
        <td>{$lists_v['smid']}</td>
        <td>{$lists_v['label']}</td>
        <td>{$lists_v['sort']}</td>
        <td>{$lists_v['src']}</td>
        <td>
            {if($lists_v['status']==1)}
            开启
            {else/}
            关闭
            {/if}
        </td>
        <td>
            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="modify({$lists_v.smid})">
                <i class="layui-icon layui-icon-edit"></i>修改
            </button>
            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="deleted({$lists_v.smid})">
                <i class="layui-icon layui-icon-delete"></i>删除
            </button>
        </td>
    </tr>
    {/foreach}
    </tbody>
</table>
</body>
<script>
    layui.use(['layer'],function (){
        $ = layui.jquery
    })
    function add(){
        layer.open({
            type:2,
            title:"添加按钮",
            shade:0.3,
            area:['550px','550px'],
            content:'/tp5/public/index.php/bews/Bew/buttonAdd?smid='+{$smid}
        })
    }
    /*function modify(smid){
        layer.open({
            type:2,
            title:"修改导航",
            shade:0.3,
            area:['550px','550px'],
            content:'/tp5/public/index.php/bews/Bew/menuModify?smid='+smid
        })
    }*/

    function modify(smid){
        layer.open({
            type: 2,
            title: '编辑按钮',
            shade: 0.3,
            area: ['550px','550px'],
            content: '/tp5/public/index.php/bews/Bew/buttonModify?smid='+smid
        });
    }


    function deleted(smid){
        layer.confirm('确定要删除吗？', {
            icon:3,
            btn: ['确定','取消']
        }, function(){
            $.get('/tp5/public/index.php/bews/Bew/menuDel',{'smid':smid},function(res){
                if(res.code === 0){
                    layer.msg(res.msg,{'icon':1})
                    setTimeout(function (){
                        window.location.reload();   // 关闭上一层页面
                    },1000)
                }else{
                    layer.msg(res.msg,{'icon':2})
                }
            },'json');
        });
    }


</script>
</html>